import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/login/Login'
import register from '@/views/login/register'
import Forget from '@/views/login/Forget'
import HelloWorld from '@/components/HelloWorld'
import Home from '@/views/home/home'
import FooBar from '@/components/fooBar'
import HeaderBar from '@/components/HeaderBar'
import ToolBar from '@/components/toolBar'
import DayReview from '@/views/dayreview/DayReview'
import Mine from '@/views/mine/mine'
import Setting from '@/views/setting/setting'
import Subscribe from '@/views/subscribe/subscribe'

Router.prototype.goBack = function() {
  this.isBack = true
  window.history.go(-1)
}

Vue.use(Router)
const router = new Router({
  routes: [{
    path: '/',
    name: 'HelloWorld',
    component: HelloWorld
  }, {
    path: '/login',
    name: 'Login',
    component: Login,
    meta: {
      headerTitel: '登录'
    }
  }, {
    path: '/login/register',
    name: 'Register',
    components: {
      default: register,
      headerbar: HeaderBar
    },
    meta: {
      headerTitel: '注册',
      header_right: false,
      header_left: true
    }
  }, {
    path: '/login/forget',
    name: 'Forget',
    components: {
      default: Forget,
      headerbar: HeaderBar
    },
    meta: {
      headerTitel: '重置密码',
      header_right: false,
      header_left: true
    }
  }, {
    path: '/index/home',
    name: 'Home',
    components: {
      default: Home,
      toolbar: ToolBar,
      headerbar: HeaderBar,
      footbar: FooBar
    },
    meta: {
      headerTitel: '今日快讯',
      header_right: true,
      header_left: false,
      footbar_active: 0
    }
  }, {
    path: '/index/dayreview',
    name: 'Dayreview',
    components: {
      default: DayReview,
      headerbar: HeaderBar,
      footbar: FooBar
    },
    meta: {
      headerTitel: '今日评',
      header_right: true,
      header_left: false,
      footbar_active: 1
    }
  }, {
    path: '/index/mine',
    name: 'Mine',
    components: {
      default: Mine,
      headerbar: HeaderBar,
      footbar: FooBar
    },
    meta: {
      headerTitel: '我的',
      header_right: false,
      header_left: false,
      header_setting: true,
      footbar_active: 3
    }
  }, {
    path: '/index/setting',
    name: 'Setting',
    components: {
      default: Setting,
      headerbar: HeaderBar
    },
    meta: {
      headerTitel: '设置',
      header_right: false,
      header_left: true
    }
  }, {
    path: '/index/subscribe',
    name: 'Subscribe',
    components: {
      default: Subscribe,
      headerbar: HeaderBar,
      footbar: FooBar
    },
    meta: {
      headerTitel: '订阅',
      header_right: false,
      header_left: true,
      footbar_active: 2
    }
  }]
})

export default router
